package com.auxgroup.hr.front.dao.repository;
import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import com.auxgroup.hr.front.dao.domain.PsCEvQstResult;
import com.auxgroup.hr.front.dao.domain.PsCEvQstResultPrimary;

/**
 * @author lv-PC
 *
 */
@Repository
public interface PsCEvQstResultRepository extends
JpaRepository<PsCEvQstResult,PsCEvQstResultPrimary>,JpaSpecificationExecutor<PsCEvQstResult> {
	
	@Query("select cEvaSectionSeq, cEvaQuestion from PsCEvQstResult where cEvaDocId=:docid and cEvaluateRole=:role and cEvaluator=:evaluator")
	public List<String[]> getSecQues(@Param("docid") String docid,@Param("role") String role, @Param("evaluator") String evaluator);
	
	
	@Query("select sum(d.cEvaPoint*d.epWeight)/sum(d.epWeight) from PsCEvQstResult d where d.cEvaDocId=:docid and d.cEvaluateRole=:role and d.cEvaluator=:evaluator")
	public String getSumPoint(@Param("docid") String docid,@Param("role") String role, @Param("evaluator") String evaluator);
	
}